package com.github.ybq.android.loading;

import android.annotation.SuppressLint;
import android.os.Bundle;
import android.os.Handler;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;

import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.github.ybq.android.spinkit.Loading;
import com.github.ybq.android.spinkit.R;
import com.github.ybq.android.spinkit.SpinKitView;
import com.github.ybq.android.spinkit.SpriteFactory;
import com.github.ybq.android.spinkit.Style;
import com.github.ybq.android.spinkit.sprite.Sprite;

/**
 * https://github.com/ybq/Android-SpinKit
 *     implementation 'com.github.ybq:Android-SpinKit:1.4.0'
 */
public class BestFragment extends Fragment implements Colors {

    public static BestFragment newInstance() {
        return new BestFragment();
    }


    @SuppressLint("InflateParams")
    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        return inflater.inflate(R.layout.fragment_best, null);
    }

    @Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        view.findViewById(R.id.btn).setOnClickListener(new View.OnClickListener() {
           @Override
           public void onClick(View v) {
//               final Loading loading = new Loading(getActivity(), SpriteFactory.create(Style.CUBE_GRID), "你好么？？");
               final Loading loading = new Loading(getActivity(), "你好么？？");
               loading.start();


               new Handler().postDelayed(new Runnable() {
                   @Override
                   public void run() {
                       loading.end();
                   }
               },3000);
           }
       });


    }

}
